<?php
$loader->requireOnce('includes/Utils.class.php');
class Salary extends ORDataObject {
	var $salary_id		= '';
	var $employee_id	= '';
	var $from_date		= '';
	var $to_date		= '';
	var $salary			= '';
	
	var $_table 		= 'salary';
	var $_key 			= 'salary_id';
	var $_internalName 	= 'Salary';
	
	function Salary() {
		parent::ORDataObject();
	}

	public function setup($id = 0){
		$this->set('id',$id);
		if($id > 0){
			$this->populate();
		}
	}
	
	public function populate(){
		parent::populate('salary_id');
	}
	
	public function getId(){
		return $this->salary_id;
	}
	
	public function setId($id){
		$this->salary_id	=	$id;
	}
	
	public function getEmployeeId(){
		return $this->employee_id;
	}
	
	public function getFromDate($format='%d/%m/%Y'){
		$date = DateObject::createFromISO($this->from_date);
        return Utils::trimDate('/', $date->toString($format));
	}

	public function getToDate($format='%d/%m/%Y'){
		$date = DateObject::createFromISO($this->to_date);
        return Utils::trimDate('/', $date->toString($format));
	}
	
	public function getSalary(){
		return $this->salary;
	}
	
	public function setData($employee_id, $salary, $from_date, $to_date = ''){
		$data	=	array(
			'employee_id'	=>	$employee_id,
			'salary'		=>	$salary,
			'from_date'		=>	$from_date,
			'to_date'		=>	$to_date
		);
		$this->populateArray($data);
	}
}
?>
